#创建存放垃圾类别的字典，以垃圾类别作为键，具体垃圾名称组成的列表作为值
waste_dict={
    "可回收垃圾":["玻璃","金属","塑料瓶","纸张","衣服",],
    "干垃圾":["餐巾纸","塑料袋","纸巾","纸尿裤","花盆","陶瓷"],
     "湿垃圾":["剩饭剩菜","瓜皮果核","花卉绿植","过期食品"],
    "有害垃圾":["电池","油漆桶","荧光灯管","废药品"],
}
#for classify,waste in waste_dict.items():
#     print(f"{classify}包含{waste}")

#设计循环，可以输入垃圾名称，如果找到垃圾，则输出垃圾类别；
while True:
    search_waste=input("请输入您要查询的垃圾：")
    find=False
    for classify,waste in waste_dict.items():
        if search_waste in waste:
            find=True
            print(f"{search_waste}的类别是{classify}")
    if search_waste=="q":
        break
    if find==False:
        print("没有找到，请自行判断")
        for classify,waste in waste_dict.items():
            print(f"{classify}包含{waste}")
        print("_"*30)
        while True:
            option = input("您是否希望将此垃圾加入到现有分类中呢（yes/no)?")
            if option == "yes":
                classify = input("你希望将垃圾加入到哪个类别？")
                waste_dict[classify].append(search_waste)
                break
            elif option == "no":
                print("可以继续查询垃圾分类")
                break
            else:
                print("您的输入有误，请重新输入")